package com.UI;

import java.lang.reflect.Array;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import com.Adapter.GolfDbAdapter;
import com.UI.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.AdapterView.OnItemSelectedListener;

public class GolfCoursesActivity extends Activity {	
		
	private String course;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.courses);

      //create the spinner to hold the list of Class events that can be added
		Spinner courseSpinner = (Spinner) findViewById(R.id.addCourseSpinner);
		ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.GolfCoursesActivityArray, android.R.layout.simple_spinner_item);
		adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		courseSpinner.setAdapter(adapter);
    
		// Set up a call back for the spinner
		courseSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
			public void onNothingSelected(AdapterView<?> arg0) {
				// Do nothing.
			}

			public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
				final Spinner selectedEvent = (Spinner) findViewById(R.id.addCourseSpinner);
				course = selectedEvent.getSelectedItem().toString();
				
				if (course.equals("Generic") ) {
					
	        		Intent viewCourse = new Intent(GolfCoursesActivity.this, Hole1.class);
					startActivity(viewCourse);
		        }
				
			}

		});
        
    }           
}      
    
    
    
